package com.wetao.lib_common.utils;

import com.wetao.lib_common.finalParam.QuestionType;

import java.util.List;

public class QuestionTypeUtil {
    public static final String TRUE_FALSE_T = "T"; //对错题最后提交后台
    public static final String TRUE_FALSE_F = "F"; //对错题最后提交后台
    public static final String TRUE_FALSE_X = "×"; //对错题显示
    public static final String TRUE_FALSE_V = "√"; //对错题显示

    //客观题
    public static boolean isObjectQuestion(int type) {
        if(type == QuestionType.QUESTIONTYPE_DANXUANTI
                || type == QuestionType.QUESTIONTYPE_DUOXUANTI
                || type == QuestionType.QUESTIONTYPE_PANDUANTI
                || type == QuestionType.QUESTIONTYPE_TINGLIXUANZETI
                || type == QuestionType.QUESTIONTYPE_WENZONGXUANZETI
                || type == QuestionType.QUESTIONTYPE_YINYUXUANZETI) {
            return true;
        } else {
            return false;
        }
    }
    //主观题
    public static boolean isSubjectQuestion(int type) {
        if(type == QuestionType.QUESTIONTYPE_TIANKONGTI
                || type == QuestionType.QUESTIONTYPE_JIANDATI
                || type == QuestionType.QUESTIONTYPE_XIEZUOTI
                || type == QuestionType.QUESTIONTYPE_TINGLITIANKONG
                || type == QuestionType.QUESTIONTYPE_JIANDATI12
                || type == QuestionType.QUESTIONTYPE_PINXIE) {
            return true;
        } else {
            return false;
        }
    }
    //判断题
    public static boolean isTrueOrFalseQuestion(int type) {
        if(type == QuestionType.QUESTIONTYPE_PANDUANTI) {
            return true;
        } else {
            return false;
        }
    }

    //选择题
    public static boolean isChoiceQuestion(int type) {
        if(type == QuestionType.QUESTIONTYPE_DANXUANTI
                || type == QuestionType.QUESTIONTYPE_DUOXUANTI
                || type == QuestionType.QUESTIONTYPE_TINGLIXUANZETI
                || type == QuestionType.QUESTIONTYPE_WENZONGXUANZETI
                || type == QuestionType.QUESTIONTYPE_YINYUXUANZETI) {
            return true;
        } else {
            return false;
        }
    }

    //多选题
    public static boolean isMutiChoiceQuestion(int type) {
        if(type == QuestionType.QUESTIONTYPE_DUOXUANTI) {
            return true;
        } else {
            return false;
        }
    }

    public static String getOptionStr (List<String> preStr) {
        String str = "";
        if(preStr == null) {
            return str;
        }
        for(int i = 0; i < preStr.size(); i++) {
            if(i == 0) {
                str += "A";
            } else if(i == 1) {
                str += "B";
            } else if(i == 2) {
                str += "C";
            } else if(i == 3) {
                str += "D";
            } else if(i == 4) {
                str += "E";
            } else if(i == 5) {
                str += "F";
            }
        }
        return str;
    }

    public static String getTypeTip(int type, List<String> preStr) {
        if(preStr == null) {
            return getTypeTip(type, "");
        }
        String str = getOptionStr(preStr);
        return getTypeTip(type, str);
    }

    //弹出提示
    public static String getTypeTip(int type, String preStr) {
        if(preStr == null) {
            preStr = "";
        }
        if(type == QuestionType.QUESTIONTYPE_DANXUANTI) {
            return "此题是选择题，请按" + preStr + "键";
        }else if(type == QuestionType.QUESTIONTYPE_DUOXUANTI) {
            return "此题是多选题，请按" + preStr + "键";
        }else if(type == QuestionType.QUESTIONTYPE_PANDUANTI) {
            return "此题是判断题，请按√×键";
        }else if(type == QuestionType.QUESTIONTYPE_TIANKONGTI) {
            return "此题是填空题，请用点阵笔写";
        }else if(type == QuestionType.QUESTIONTYPE_JIANDATI) {
            return "此题是简单题，请用点阵笔写";
        }else if(type == QuestionType.QUESTIONTYPE_XIEZUOTI) {
            return "此题是写作题，请用点阵笔写";
        }else if(type == QuestionType.QUESTIONTYPE_TINGLIXUANZETI) {
            return "此题是听力选择题，请按" + preStr + "键";
        }else if(type == QuestionType.QUESTIONTYPE_TINGLITIANKONG) {
            return "此题是听力填空题，请用点阵笔写";
        }else if(type == QuestionType.QUESTIONTYPE_WENZONGXUANZETI) {
            return "此题是文综选择题，请按" + preStr + "键";
        }else if(type == QuestionType.QUESTIONTYPE_JIANDATI12) {
            return "此题是简单题，请用点阵笔写";
        }else if(type == QuestionType.QUESTIONTYPE_YINYUXUANZETI) {
            return "此题是英语选择题，请按" + preStr + "键";
        }else if(type == QuestionType.QUESTIONTYPE_PINXIE) {
            return "此题是拼写题，请用点阵笔写";
        }
        return "";
    }
}
